package pl.bizuteria.sklep.admin.client.activity.mapper;


import pl.bizuteria.sklep.admin.client.ProductModule;
import pl.bizuteria.sklep.admin.client.place.ProxyCreatePlace;
import pl.bizuteria.sklep.admin.client.place.ProxyEditPlace;
import pl.bizuteria.sklep.admin.client.place.ProxyListPlace;
import pl.bizuteria.sklep.admin.client.ui.ITwoSlotView;
import pl.bizuteria.sklep.admin.client.ui.ZakladkiView;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.inject.Inject;

public class AppActivityMapper implements ActivityMapper {

	private final ZakladkiView zakladkiView;
	private ProductModule productModule;
//	ProductActivityMapper productActivityMapper; 

	
	@Inject
	public AppActivityMapper(ZakladkiView zakladkiView,
			ProductActivityMapper productActivityMapper, ProductModule productModule) {
		super();
		this.zakladkiView = zakladkiView;
		this.productModule = productModule;
	}

	public Activity getActivity(Place place) {
		
		if(productModule.handlesPlace(place)){
			return new AbstractActivity() {
				
				public void start(AcceptsOneWidget panel, EventBus eventBus) {
					panel.setWidget(productModule.getView());
				}
			};
		}
		
		//bracelets
		//clips
		//earings
//		if (place instanceof ProxyCreatePlace  || place instanceof ProxyEditPlace || place instanceof ProxyListPlace) {
//			return productActivity;
//		}
//		else if( place instanceof ProxyListPlace) {
//			return productActivity;
//		}
//		else if (place instanceof ProxyEditPlace || place instanceof ProxyCreatePlace) {
//			return productActivity;
//		}
		return null;
	}

}
